package com.example.workbench.service.impl;

import com.example.utils.SqlSessionUtil;
import com.example.workbench.dao.ActivityRemarkDao;
import com.example.workbench.domain.ActivityRemark;
import com.example.workbench.service.ActivityRemarkService;

import java.util.List;

public class ActivityRemarkServiceImpl implements ActivityRemarkService {

    private ActivityRemarkDao arDao = SqlSessionUtil.getSqlSession().getMapper(ActivityRemarkDao.class);

    public List<ActivityRemark> getActivityRemarkByAid(String aid) {
        List<ActivityRemark> arList = arDao.getActivityRemarkByAid(aid);
        return arList;
    }

    public boolean deleteRemark(String id) {
        boolean flag = true;
        int count = arDao.deleteRemark(id);
        if (count != 1){
            flag = false;
        }
        return flag;
    }

    public boolean saveRemark(ActivityRemark ar) {
        boolean flag = true;
        int count = arDao.saveRemark(ar);
        if (count != 1){
            flag = false;
        }
        return flag;
    }

    public boolean updateRemark(ActivityRemark ar) {
        boolean flag = true;
        int count = arDao.updateRemark(ar);
        if (count != 1){
            flag = false;
        }
        return flag;
    }
}
